package cn.uc.bs;


import cn.uc.db.DBObject;
import android.content.ContentValues;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.PointF;


public class ContentObject extends DBObject{
    private String id;
    private String iParentId;
    private String iText;
    private Bitmap iBitmap;
    private Point iPos;
    private PointF iScaleRatios = new PointF(1, 1);
    private float iAngle;
    private int iType;
    
    public enum ContentType{
        TYPE_IMAGE,
        TYPE_TEXT,
        TYPE_MIX,
    }
    
    
    public ContentObject(String aId){
        id = aId;
    }
    
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
    
    public String getParentId() {
        return iParentId;
    }

    public void setParentId(String aParentId) {
        this.iParentId = aParentId;
    }
    
    public String getText() {
        return iText;
    }
    public void setText(String iText) {
        this.iText = iText;
    }
    public Bitmap getBitmap() {
        return iBitmap;
    }
    public void setBitmap(Bitmap iBitmap) {
        this.iBitmap = iBitmap;
    }
    public Point getPos() {
        return iPos;
    }
    public void setPos(Point iPos) {
        this.iPos = iPos;
    }

    public float getAngle() {
        return iAngle;
    }
    public void setAngle(float iAngle) {
        this.iAngle = iAngle;
    }
    
    public PointF getScaleRatios() {
        return iScaleRatios;
    }

    public void setScaleRatios(PointF aScaleRatios) {
        this.iScaleRatios = aScaleRatios;
    }

    public int getType() {
        return iType;
    }
    public void setType(int iType) {
        this.iType = iType;
    }
   

    @Override
    public ContentValues dbValues() {
        // XXX Auto-generated method stub
      ContentValues iniValues = new ContentValues();
      iniValues.put("id",  getId());
      iniValues.put("parent_id",  getParentId());
      iniValues.put("text", getText());

//      iniValues.put(TABLE_PSWD, account.getPswd());
      return iniValues;
    }

    @Override
    public void setPrimaryKey() {
        // XXX Auto-generated method stub
        iPrimaryKey = "ID";
    }
    
    public ContentObject(Cursor aCursor){
        setId(aCursor.getString(0));
        setParentId(aCursor.getString(1));
        setText(aCursor.getString(2));
    }

}
